<?php

//长文本列表页（更多）

//加载个人中心配置文件
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/user/inc.php");
include_once($_SERVER['DOCUMENT_ROOT'] ."/include/forum/inc.php");
error_reporting(E_ERROR | E_PARSE);


//所有的参数
$g_cgival 	= array();
//存储中间数据 非输出数据 可以不用
$g_pro	 	= array();
//要显示的数据 输出数据
$g_show 	= array();

function check_cgi_pro()
{		
	global $g_cgival, $g_pro, $g_show, $config;

	//板块id
	cgi::both($g_cgival["f_id"], "f_id", 0);
	
	//get page info 
	cgi::both($g_cgival["p"], "p", 1);
	cgi::both($g_cgival["pcount"], "pcount", 10);
	
	//set max and min value
	if($g_cgival["p"] < 1)$g_cgival["p"]=1;
	if($g_cgival["pcount"] > 100)$g_cgival["pcount"]=100;
	
}


function get_data()
{
	global $g_cgival, $g_pro, $g_show, $config;
	
	//get data
	$f_id = $g_cgival["f_id"];
	$p = $g_cgival["p"];
	$pcount = $g_cgival["pcount"];
	
	$db_long_text_info = new db_long_text_info();
	//get count by f_id
	$g_show["count"] = $db_long_text_info->get_long_text_count_by_f_id($f_id);
	
	//get list by f_id
	$g_show["list"] = $db_long_text_info->get_long_text_list_by_f_id($f_id,$p,$pcount);
	
	
}

try {
	$g_show['error'] = 0;
	$g_show['errmsg'] = "";
	check_cgi_pro();
	get_data();
	
} catch (Exception $e) {
	$g_show['error'] = 1;
	$g_show['errmsg'] = $e->getMessage();
}

show_pro();


exit;

function show_pro()
{
	global $g_cgival, $g_pro, $g_show, $config;

	$smarty = p_get_smarty();	
	$smarty->assign("g_show", $g_show);
	if (isset($_GET["debug"]))
	{
		print_r($g_show);
	}
	$smarty->display("user/index.html");
	
	
	
	unset($g_cgival);
	unset($g_pro);
	unset($g_show);
	unset($config);
	
}

